# Maintainer: Leonidas Spyropoulos <artafinde@archlinux.org>
# Contributor: David Runge <dvzrv@archlinux.org>
# Contributor: Luca Weiss <luca (at) z3ntu (dot) xyz>

pkgname=coeurl
pkgver=0.3.0
pkgrel=2
pkgdesc="A simple async wrapper around CURL for C++"
arch=("loong64" "x86_64")
url="https://nheko.im/nheko-reborn/coeurl"
license=('MIT')
depends=(gcc-libs glibc)
makedepends=(curl fmt libevent meson spdlog)
provides=(libcoeurl.so)
source=("https://nheko.im/nheko-reborn/coeurl/-/archive/v$pkgver/coeurl-v$pkgver.tar.gz")
sha256sums=('48b07482364edcbed03e352f6b8b07e327c331eaa45707ad58e62930fa361382')
b2sums=('44c990a978f5970afacadff858502db5efd6709f8e5dcf43eeecfabda7f93262258a8a9fd7b1b411b8e28156657e02e1ceb532f9675265fe9f8143f4b07d844f')

build() {
  arch-meson $pkgname-v$pkgver build
  meson compile -C build
}

# Tests fail 
# - Needs cmake to properly detect doctest dependency https://github.com/doctest/doctest/issues/742
# - Needs to enable them with `-D tests=true`
# - Needs to execute ./scripts/run_testserver.sh and ./scripts/run_tls_testserver.sh prior to tests
# check() {
#   ninja test -C build
# }

package() {
  depends+=(
    curl libcurl.so
    fmt libfmt.so
    libevent libevent_{core,pthreads}-2.1.so
    spdlog libspdlog.so
  )

  meson install -C build --destdir "$pkgdir"
  install -vDm 644 $pkgname-v$pkgver/LICENSE -t "$pkgdir/usr/share/licenses/$pkgname/"
}

# vim:set ft=sh sw=2 sts=2 et:
